package com.zyit.mapper;

import com.zyit.model.SysUsers;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


import java.util.List;

public interface SysUsersMapper {

    @Select("select * from sys_users")
    List<SysUsers> findAll();


    @Select("select * from sys_users where id = #{id}")

    SysUsers findById(Long id);

    @Insert("insert into sys_users (department_id, user_type, head_url, account, user_name, password, salt, created_time," +
            "updated_time, created_user_id)" +
            "values (#{departmentId},#{userType},#{headUrl},#{account},#{userName},#{password},#{salt},#{createdTime},#{updatedTime},#{createdUserId})")
    int addUser(SysUsers sysUsers);


    @Select("SELECT * FROM sys_users LIMIT #{p}, #{size}")
    List<SysUsers> pageAll(@Param("p") int p, @Param("size") int size);

    @Select("select * from sys_users where account = #{account} and password=#{password}")
    SysUsers login(SysUsers sysUsers);
}
